#ifndef CONTROLBOARD_H
#define CONTROLBOARD_H

#include <QLabel>
#include <QPushButton>
#include <QMainWindow>
#include "TimerSlider.h"
#include "Decoder.h"
#include "Decoder_xine.h"

/**
 * @brief The class in charge of the QT GUI of myfirstplayer
 *
 * ControlBoard contains the most part of the gui of myfirstplayer and uses
 * QT to create all the widgets. It heavily depends on the "signal" and "slot"
 * mechanism provided by QT to update gui and information or detect the botton
 * pressing, so the most important thing is to declare Q_OBJECT in the beginning
 * of the class definition. All the bottons and the menus are created in the
 * constructor ControlBoard() and are connected signals to responding slots.
 * In fact, the slot functions occupy the most part of the implementation of
 * ControlBoard.
 *
 * @todo A playlist botton and a playlist
 */
class ControlBoard : public QMainWindow
{
	/* Declare Q_OBJECT in the definition of the class if you want
	 * to use the 'signal' and 'slot' mechanism provided by Qt.    */
	Q_OBJECT

public:
	ControlBoard();
	QString getFileName() const;
	enum playBackState{
		StatePlay, StatePause, StateStop
	};

private slots:
	void setOpenFileName();
	void about();
	void play_and_pause();
	void stop();
	void sliderPressed();
	void sliderSeek();

	void updateSeek();

private:
	void createActions();
	void createMenus();

	QLabel *title;
	QPushButton *play_b;
	QPushButton *stop_b;
	TimerSlider *mySlider;

	Decoder *decoder;

	QTimer *updateTimer;

	QMenu *fileMenu;
	QMenu *aboutMenu;

	QAction *openAct;
	QAction *quitAct;
	QAction *aboutAct;

	QString openFileName;
	QString prevPath;
	playBackState playState;

};

#endif
